<?php

/**
 * Following widget
 */

//copied from Friend widget, using elgg_get_entities_from_relationship() instead of getFriends() - MK

// owner of the profile page
$owner = get_user($vars['entity']->owner_guid);

// the number of friends to display
$num = (int) $vars['entity']->num_display;

// get the correct size
$size = $vars['entity']->icon_size;

$followers = elgg_get_entities_from_relationship(array(
	'type' => 'user',
	'relationship' => 'follower',
	'relationship_guid' => elgg_get_page_owner_guid(),
));


// If there are any friends to view, view them
if (is_array($followers) && sizeof($followers) > 0) {

	echo "<div id=\"widget_friends_list\">";

	foreach($followers as $follower) {
		echo "<div class=\"widget_friends_singlefriend\" >";
		echo elgg_view("profile/icon",array('entity' => get_user($follower->guid), 'size' => $size));
		echo "</div>";
	}

	echo "</div>";
}
